#!/bin/bash

wd="."

if [[ $# -gt 0 ]]; then
    if [ $# -eq 1 ]; then
        wd=$*
    else
        echo "This tool is provided to git pull the repos in the path you gave."
        echo "Usage:gitup [path].More than one argument is not supported."
        exit 1
    fi
fi

git version

if [[ $? -ne 0 ]]; then
    ehco "Git tools are not available."
    exit 1
fi

for d in $(ls -F $wd | grep "/$")
do
    echo $d
    echo $d >> $(dirname $0)/gitup.log
    cd $d 
    if [[ $? ]]; then
        git pull
        cd ..
    fi
done

